using System;
using System.Collections.ObjectModel;
using Microsoft.VisualStudio.Modeling;

namespace DslCrossModelFramework {
    public interface IModelFileInfo {
        IModelFile ModelFile { get; }

        bool IsLoaded { get; }

        DslToolsPackageInfo DslPackageInfo { get; }
        ModelElement ModelRoot{ get;}

        ModelElement Load();
        ModelElement Load(IModelFileHelper modelFileHelper);
        bool Contains(ModelElement mel);
        ModelElement GetElementByReference(string reference);
        ReadOnlyCollection<ModelElement> AllElements();
        Store Store{ get;}
        void MakeDynamic(Store dynamicStore);
        void MakeShared(Store sharedStore);
        bool IsDynamic{ get;}

        void Unload();

        event EventHandler<ModelFileEventArgs> Loading;
        event EventHandler<ModelFileEventArgs> Loaded;
        event EventHandler<ModelFileEventArgs> Unloading;
        event EventHandler<ModelFileEventArgs> Unloaded;
    }

    public class ModelFileEventArgs : EventArgs {
        public ModelFileEventArgs(IModelFileInfo fileInfo) {
            this.fileInfo = fileInfo;
        }

        public IModelFileInfo FileInfo {
            get { return fileInfo; }
        }
        private IModelFileInfo fileInfo;
        
    }
}
